package com.mas.admin.biz.dal.mysql.oauth2;

import com.mas.admin.biz.dal.dataobject.oauth2.OAuth2RefreshTokenDO;
import com.mas.framework.mybatis.core.mapper.BaseMapperX;
import com.mas.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author godyao
 * @description OAuth2RefreshTokenDO Mapper
 * @date 2023年01月31日21:04
 */
@Mapper
public interface OAuth2RefreshTokenMapper extends BaseMapperX<OAuth2RefreshTokenDO> {
    default int deleteByRefreshToken(String refreshToken) {
        return delete(new LambdaQueryWrapperX<OAuth2RefreshTokenDO>()
                .eq(OAuth2RefreshTokenDO::getRefreshToken, refreshToken));
    }

    default OAuth2RefreshTokenDO selectByRefreshToken(String refreshToken) {
        return selectOne(OAuth2RefreshTokenDO::getRefreshToken, refreshToken);
    }
}
